Covid Case and Death Visualization by Elbert H. Nugroho

Data Source: Our World in Data

Data Visualization

Theme Algo

theme_algo <- theme(
  panel.background = element_rect(fill = "white"),
  panel.grid.major = element_line(colour = "gray80"),
  panel.grid.minor = element_blank(),
  plot.title = element_text(family = "serif", 
                            size = 18)
)

Case per Month Trend Line

TL_CPM <- death_agg %>% 
            filter(location %in% c("Indonesia", "Singapore", "Malaysia")) %>% 
            ggplot(aes(month, total_cases_monthly, color = location, group = location,
                       text = glue("Month : {month}
                         Country : {location}
                         Case : {number(total_cases_monthly, big.mark = ",", accuracy = 1)}"))) + 
  scale_y_continuous(labels = number_format(big.mark = ","))+ 
            geom_line() +
            labs(title = "Monthly COVID-19 Case by Country",
                 x = NULL,
                 y = "Number of Cases",
                 color = "Country"
            ) + theme_algo
  
  
ggplotly(TL_CPM, tooltip = "text") 
## Warning: `group_by_()` is deprecated as of dplyr 0.7.0.
## Please use `group_by()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.

Death per Month Trend line

TL_DPM <- death_agg %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(month, total_death_monthly, color = location, group = location,
                       text = glue("Month : {month}
                         Country : {location}
                         Deaths : {number(total_death_monthly, big.mark = ",", accuracy = 1)}"))) + 
  scale_y_continuous(labels = number_format(big.mark = ","))+ 
            geom_line() +
            labs(title = "Monthly COVID-19 Deaths by Country",
                 x = NULL,
                 y = "Number of Deaths",
                 color = "Country"
            ) + theme_algo

ggplotly(TL_DPM, tooltip = "text")

Bar Graph for Cases and Death in September

BG_CIS <- death_agg_sept %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(location, total_cases_by_september, fill = location, group = location,
                       text = glue("Country : {location}
                         Cases : {number(total_cases_by_september, big.mark = ",", accuracy = 1)}"))) + 
  scale_y_continuous(labels = number_format(big.mark = ","))+ 
            geom_col() + 
            labs(title = "September COVID-19 Cases by Country",
                 x = NULL,
                 y = "Number of Cases",
                 color = "Country"
            ) + theme_algo

ggplotly(BG_CIS  + scale_fill_brewer(palette = "Reds"), tooltip = "text")
BG_DIS <- death_agg_sept %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(location, total_death_by_september, color = location, group = location,
                       text = glue("Country : {location}
                         Deaths : {number(total_death_by_september, big.mark = ",", accuracy = 1)}"))) + 
  scale_y_continuous(labels = number_format(big.mark = ","))+ 
            geom_col() +
            labs(title = "September COVID-19 Deaths by Country",
                 x = NULL,
                 y = "Number of Deaths",
                 color = "Country"
            ) + theme_algo

ggplotly(BG_DIS, tooltip = "text")

Average Daily Cases and Deaths per Country per Month (May be utilized to see if treatments or government policy for social distancing is effective)

TL_ACM <- death_agg %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(month, average_daily_case, color = location, group = location,
                       text = glue("Month : {month}
                         Country : {location}
                         Average Daily Case : {number(average_daily_case, big.mark = ",", accuracy = 1)}"))) + 
  scale_y_continuous(labels = number_format(big.mark = ","))+ 
            geom_line() +
            labs(title = "COVID-19 Daily Case Average by Country",
                 x = NULL,
                 y = "Average Daily Case",
                 color = "Country"
            ) + theme_algo

ggplotly(TL_ACM, tooltip = "text")
TL_ADM <- death_agg %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(month, average_daily_deaths, color = location, group = location,
                       text = glue("Month : {month}
                         Country : {location}
                         Average Daily Deaths : {number(average_daily_deaths, big.mark = ",", accuracy = 1)}"))) + 
  scale_y_continuous(labels = number_format(big.mark = ","))+ 
            geom_line() +
            labs(title = "COVID-19 Daily Death Average by Country",
                 x = NULL,
                 y = "Average Daily Death",
                 color = "Country"
            ) + theme_algo

ggplotly(TL_ADM, tooltip = "text")

Daily Case Trend

TL_DC <- death_new %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(date, total_cases, color = location, group = location,
                       text = glue("Date : {date}
                         Country : {location}
                         Cases : {number(total_cases, big.mark = ",", accuracy = 1)}"))) + 
 scale_y_continuous(labels = number_format(big.mark = ",")) +
            scale_x_date(date_breaks = "1 month", labels = date_format(format = "%b"))+
            geom_line() +
            labs(title = "COVID-19 Daily Cases Trend by Country",
                 x = NULL,
                 y = "Number of Daily Cases",
                 color = "Country"
            ) + theme_algo

ggplotly(TL_DC, tooltip = "text")

Daily Death Trend

TL_DD <- death_new %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(date, total_deaths, color = location, group = location,
                       text = glue("Date : {date}
                         Country : {location}
                         Deaths : {number(total_deaths, big.mark = ",", accuracy = 1)}"))) + 
 scale_y_continuous(labels = number_format(big.mark = ",")) +
            scale_x_date(date_breaks = "1 month", labels = date_format(format = "%b"))+
            geom_line() +
            labs(title = "COVID-19 Daily Death Trend by Country",
                 x = NULL,
                 y = "Number of Daily Deaths",
                 color = "Country"
            ) + theme_algo

ggplotly(TL_DD, tooltip = "text")

World Case Rate

TL_WC <- death_new %>% 
  filter(location == "World") %>%
  ggplot(aes(date, total_cases, color = location, group = location,
                       text = glue("Date : {date}
                         Number of Cases : {number(total_cases, big.mark = ",", accuracy = 1)}"))) + 
 scale_y_continuous(labels = number_format(big.mark = ",")) +
            scale_x_date(date_breaks = "1 month", labels = date_format(format = "%b"))+
            geom_line() +
            labs(title = "COVID-19 Daily Case Trend",
                 x = NULL,
                 y = "Number of Daily Cases",
                 color = "Country"
            ) + theme_algo

ggplotly(TL_WC, tooltip = "text")

World Death Rate

TL_WD <- death_new %>% 
  filter(location == "World") %>%
  ggplot(aes(date, total_deaths, color = location, group = location,
                       text = glue("Date : {date}
                         Number of Deaths : {number(total_deaths, big.mark = ",", accuracy = 1)}"))) + 
 scale_y_continuous(labels = number_format(big.mark = ",")) +
            scale_x_date(date_breaks = "1 month", labels = date_format(format = "%b"))+
            geom_line() +
            labs(title = "COVID-19 Daily Deaths Trend",
                 x = NULL,
                 y = "Number of Daily Deaths",
                 color = "Country"
            ) + theme_algo
  

ggplotly(TL_WD, tooltip = "text")
death_fatality
## # A tibble: 180 x 2
##    location             case_fatality_rate_monthly
##    <fct>                                     <dbl>
##  1 Singapore                                0.0474
##  2 Qatar                                    0.168 
##  3 Burundi                                  0.222 
##  4 Maldives                                 0.347 
##  5 Bahrain                                  0.363 
##  6 Sri Lanka                                0.385 
##  7 Botswana                                 0.400 
##  8 Rwanda                                   0.418 
##  9 Iceland                                  0.468 
## 10 United Arab Emirates                     0.532 
## # ... with 170 more rows
BG_CFR <- death_fatality %>% 
            filter(location %in% c("Indonesia", "Singapore", "United States")) %>% 
            ggplot(aes(case_fatality_rate_monthly, reorder(location, case_fatality_rate_monthly), fill = location, group = location,
                       text = glue("Country : {location}
                         Case Fatality Rate in Percentage : {case_fatality_rate_monthly}"))) + 
            geom_col() +
            labs(title = "Case Fatality Rate by Country",
                 x = "Case Fatality Rate Percentage",
                 y = "Location",
                 color = "Country"
            ) + theme_algo

ggplotly(BG_CFR + scale_fill_brewer(palette = "OrRd"), tooltip = "text")